package com.fivefaces.ide.plugins.impl;

import com.fivefaces.ide.plugins.ConsoleExecutablePathService;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

/**
 * Author: abdul2000@gmail.com
 * Date: 13/04/11
 * Time: 11:33 AM
 */
public class LinuxCommandBuilder extends AbstractCommandBuilder {

    public LinuxCommandBuilder(ConsoleExecutablePathService consoleExecutablePathService) {
        super(consoleExecutablePathService);
    }

    protected FileWriter writeFile(String path, FileWriter fileWriter, File executeFile) throws IOException {
        fileWriter = new FileWriter(executeFile);
        fileWriter.write("#!/bin/sh\n");
        fileWriter.write("cd " + path + "\n");
        fileWriter.write(getExecutablePath() + "\n");
        return fileWriter;
    }
}
